package com.zaydanwu.cla.controller.students;

import com.zaydanwu.cla.model.EmptyClassroom;
import com.zaydanwu.cla.model.result.ApiResult;
import com.zaydanwu.cla.service.EmptyClassroomService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @BelongsProject: cla
 * @BelongsPackage: com.zaydanwu.cla.controller.students
 * @Author: zaydanwu
 * @CreateTime: 2018-12-10 22:42
 * @Description:
 */
@RestController
@RequestMapping("/cla/api")
public class EmptyClassroomController {

    @Resource
    private EmptyClassroomService emptyClassroomService;

    @RequestMapping("/getAllEmptyClassroom")
    public ApiResult<List<EmptyClassroom>> getAllEmptyClassroom() {

        List<EmptyClassroom> allEmptyClassroom = emptyClassroomService.getAllEmptyClassroom();

        return ApiResult.success(allEmptyClassroom);
    }

    @RequestMapping("/getEmptyClassroomByVillage")
    public ApiResult<List<EmptyClassroom>> getEmptyClassroomByVillage(@RequestParam String village) {

        List<EmptyClassroom> emptyClassroomByVillage = emptyClassroomService.getEmptyClassroomByVillage(village);

        return ApiResult.success(emptyClassroomByVillage);
    }
}
